<template>
	<view>
		<uni-forms ref="form" :rules="{}">
			<uni-forms-item label="" name="">
				<uni-easyinput  v-model="userInfo.username" placeholder="请输入用户名" />
			</uni-forms-item>
			<uni-forms-item label="" name="">
				<uni-easyinput type="password" v-model="userInfo.password" placeholder="请输入密码" />
			</uni-forms-item>
			<uni-forms-item label="" name="">
				<button type="primary" @click="login">登录</button>
			</uni-forms-item>
		</uni-forms>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{
					username:'',
					password:''
				}
			}
		},
		methods: {
			login(){
				//如何获取用户输入的数据
				//如果用户名是TOM 并且密码是123，则提示成功，否者提示失败
				if(this.userInfo.username=='TOM' && this.userInfo.password=='123'){
					uni.showToast({
						title:'成功'
					});
				}else{
					uni.showToast({
						title:'失败',
						icon:'error'
					});
				}
			}
		}
	}
</script>

<style>

</style>